package com.zzg.cloud.task;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zzg.cloud.util.XXLLogUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MySpringCloudDemoTask {
    @XxlJob("MySpringCloudDemoTask")
    public ReturnT<String> execute(String s) {
        try {
            XXLLogUtil.log("执行参数param：{}", s);
            XXLLogUtil.log("执行开始。。。");
            XXLLogUtil.log("执行结束");
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            XXLLogUtil.error("定时器执行失败，param：{}，message:{}", s, e.getMessage(), e);
            return ReturnT.FAIL;
        }
    }
}
